spb/datacenterindex
Public
HTML 53.9%
TypeScript 44.5%
JavaScript 0.6%
SQL 0.5%
1import { api } from "@/lib/api";2import { fmtInt, fmtMw } from "@/lib/format";3import { OG_CONTENT_TYPE, OG_SIZE, renderOg } from "@/lib/og-template";45export const alt = "Data centers by country on DataCenterIndex";6export const size = OG_SIZE;7export const contentType = OG_CONTENT_TYPE;8export const revalidate = 3600;910export default async function Image({ params }: { params: Promise<{ slug: string }> }) {11 const { slug } = await params;12 const r = await api.country(slug);13 if (!r.ok) return renderOg({ eyebrow: "Country", title: `Data centers in ${slug.replace(/-/g, " ")}`, subtitle: "Facilities, capacity, operators, cloud regions and projects." });14 const c = r.data;15 const pipe = c.constructionMw === null && c.plannedMw === null ? null : (c.constructionMw ?? 0) + (c.plannedMw ?? 0);16 return renderOg({17 eyebrow: `Country · ${c.iso2}`,18 title: `Data centers in ${c.name}`,19 subtitle: [c.region, `${fmtInt(c.operatorCount)} operators`, `${fmtInt(c.hyperscaleCount)} hyperscale`].filter(Boolean).join(" · "),20 stats: [21 { label: "Facilities", value: fmtInt(c.facilityCount) },22 { label: "Operational MW", value: c.knownMw ? fmtMw(c.knownMw) : "—" },23 { label: "Pipeline", value: pipe ? `≈ ${fmtMw(pipe)}` : "—" },24 { label: "Cloud regions", value: fmtInt(c.cloudRegionCount) },25 ],26 });27}28